/ Assembly List / LJCNetCommon / HTMLBuilder / AddIndent

Namespace - LJCNetCommon


Parameters
increment - The amount to increment or decrement the indent count.

Returns

The current indent count.

Syntax

C#
public Int32 AddIndent(Int32 increment = 1)

Changes the IndentCount by the provided value.

Example

C#
// Defaults: IndentCharCount = 2, LineLimit = 80, WrapEnabled = false.
var hb = new HTMLBuilder();

// Example Method:
// The builder keeps track of the current number of indents.
// Adds 1 indent by default.
hb.AddIndent();

// Adds text without modification.
hb.AddText("This text is not indented.");

// Starts the text with a newline if the builder already has text
// and param allowNewLine = true and builder text does not end with
// a newline.
// The text begins with the current indent string if param
// addIndent = true.
// Defaults: addIndent = true, allowNewLine = true.
hb.Text("This text is indented.");

// No Indent
var NoIndent = false;
hb.Text("Not indented.", NoIndent);

// Do not start a newline.
var NoNewLine = false;
hb.Text(" No start with newline.", NoIndent, NoNewLine);
var result = hb.ToString();

// result:
// This text is not indented.
//   This text is indented.
// Not indented. No start with newline.

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.